
angular.module('U9ImPDA.directives')

.directive('autoVerticalAlign', ['$timeout', function ($timeout) {
    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            $timeout(function () {
                var elementHeight = element.height(),
                    docHeight = angular.element(document).height(),
                    headerHeight = attrs['autoVerticalAlign'] ? parseInt(attrs['autoVerticalAlign']) : 0;
                element.css('padding-top', (docHeight - elementHeight - headerHeight) / 2);
            });
        }
    };
}]);